<?php
require_once( __DIR__ . '/inc/common.php' );

// Get the video id from URL.
// Such as "C0DPdy98e4c"
$video_id = @$_GET['v'];

$templates = new League\Plates\Engine( 'themes/' . $config['theme'] );

if ( strlen( $video_id ) == 11 ) {
	$video = new \Vioscope\Video( $video_id );
	echo $templates->render( 'video', array( 'info' => $video->info, 'config' => $config ) );
} else {
	echo $templates->render( 'video', array(
		'error' => 'No valid video id provided'
	) );
}
